<?php
class Contact
{
	public function __construct()
	{
		
	}
	
	public function index()
	{
		
	}
	
	public function sendMail()
	{
		$request = CommonFunc::getRequest();
		$name = $request['name'];
		$email = $request['email'];
		$message = $request['message'];
		$msgbody = "";
		
		$subject = "Officesupplies Inquiry from " . $name;
		
		$msgbody .= "Dear Admin,\n\n";
		$msgbody .= "You have an inquiry from " . $name . "\n\n";
		$msgbody .= "----------------------------------------------\n\n";
		$msgbody .= "Name: " . $name . "\n\n" . "Email: " . $email . "\n\n" . "Message :" . $message . "\n\n";
		$msgbody .= "----------------------------------------------\n\n";
		$msgbody .= "This is an auto generated email. Please do not reply";
		
		$headers = 'From:'.$request['email']. "\r\n" .
                    'Reply-To:'.$request['email'] . "\r\n" .
                    '';

		
		if(mail(ADMIN_EMAIL, $subject, $msgbody, $headers))
		{
			echo "<span class='success'>Your message has been successfully sent. One of our staff member will contact you soon. Thankyou for choosing " . SITENAME . "</span>";
		}
	}
        public function sendrequestcatalogMail()
	{
		$request = CommonFunc::getRequest();
		$name = $request['name'];
		$email = $request['email'];
                $contactno = $request['contactno'];
		$message = $request['message'];
		$msgbody = "";

		$subject = "Officesupplies Catalog Request from " . $name;

		$msgbody .= "Dear Admin,\n\n";
		$msgbody .= "You have an Catalog Request from " . $name . "\n\n";
		$msgbody .= "----------------------------------------------\n\n";
		$msgbody .= "Name: " . $name . "\n\n" . "Email: " . $email . "\n\n" . "Contact No: " . $contactno . "\n\n" . "Message :" . $message . "\n\n";
		$msgbody .= "----------------------------------------------\n\n";
		$msgbody .= "This is an auto generated email. Please do not reply";

		$from = $request['email'];

                $headers = 'From:'.$request['email']. "\r\n" .
                    'Reply-To:'.$request['email'] . "\r\n" .
                    '';

		if(mail(ADMIN_EMAIL, $subject, $msgbody, $headers))
		{
			echo "<span class='success'>Your message has been successfully sent. One of our staff member will contact you soon. Thank you for choosing " . SITENAME . "</span>";
		}
	}



        
}	
?>